Low-Pass
Filter
α is the sensor-believing value
x is the measurement
value
y is the
answer value
y[i] := α * x[i] + (1-α) * y[i-1]
float smooth(float data, float filterVal, float smoothedVal)
{
smoothedVal = (data * (1 - filterVal)) + (smoothedVal * filterVal);
return smoothedVal;
}
https://en.wikipedia.org/wiki/Low-pass_filter